// BWGridGeometry.h -- hold the geometry information for the stitch editing
//                     grid

#import <Cocoa/Cocoa.h>

typedef enum {
    kQuadrant_None,
    kQuadrant_Top,
    kQuadrant_Bottom,
    kQuadrant_Left,
    kQuadrant_Right,
    kQuadrant_NW,
    kQuadrant_NE,
    kQuadrant_SW,
    kQuadrant_SE,
    kQuadrant_Center
} BWGrid_Quadrant;


@class BWFabric;

@interface BWGridGeometry : NSObject
{
    BWFabric *fabric;

    int countAcross;
    int countDown;

    float cellWidth;
    float cellHeight;
}

- (void) setFabric: (BWFabric *) fabric;
- (BWFabric *) fabric;


- (float) width;
- (float) height;

- (NSRect) rectForRow: (int) row
               column: (int) column;

- (NSPoint) pointForIntersectionAtRow: (int) row
                               column: (int) column;

- (void) getRow: (int *) row
      andColumn: (int *) column
        atPoint: (NSPoint) point;

- (void) getIntersectionRow: (int *) row
                  andColumn: (int *) column
                  nearPoint: (NSPoint) point;

- (void) getIntersectionRow: (int *) row
                     column: (int *) column
                   quadrant: (BWGrid_Quadrant *) quadrant
                  nearPoint: (NSPoint) point;

- (NSPoint) pointForIntersectionAtRow: (int) row
                               column: (int) column
                             quadrant: (BWGrid_Quadrant) quadrant;

// --------------------------------------------------

- (void) setCountAcross: (int) across;
- (int) countAcross;

- (void) setCountDown: (int) down;
- (int) countDown;

- (void) setCellWidth: (float) width;
- (float) cellWidth;

- (void) setCellHeight: (float) height;
- (float) cellHeight;

@end // BWGridGeometry

